package grafica.ventanas;

import grafica.controladores.ControladorNuevaMascota;

import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JButton;

public class VentanaNuevaMascota extends Ventana{

	private JFrame frmNuevaMascota;
	private ControladorNuevaMascota cont = null;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;

	/**
	 * Launch the application.
	 */
/*	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					VentanaNuevaMascota window = new VentanaNuevaMascota();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}*/

	/**
	 * Create the application.
	 */
	public VentanaNuevaMascota() {
		initialize();
		cont = new ControladorNuevaMascota(this);
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmNuevaMascota = new JFrame();
		frmNuevaMascota.setTitle("Nueva Mascota");
		frmNuevaMascota.setBounds(100, 100, 255, 233);
		frmNuevaMascota.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		frmNuevaMascota.getContentPane().setLayout(null);
		
		textField = new JTextField();
		textField.setBounds(106, 34, 86, 20);
		frmNuevaMascota.getContentPane().add(textField);
		textField.setColumns(10);
		
		textField_1 = new JTextField();
		textField_1.setBounds(106, 65, 86, 20);
		frmNuevaMascota.getContentPane().add(textField_1);
		textField_1.setColumns(10);
		
		textField_2 = new JTextField();
		textField_2.setBounds(106, 96, 86, 20);
		frmNuevaMascota.getContentPane().add(textField_2);
		textField_2.setColumns(10);
		
		JLabel lblApodo = new JLabel("Apodo");
		lblApodo.setBounds(10, 37, 46, 14);
		frmNuevaMascota.getContentPane().add(lblApodo);
		
		JLabel lblRaza = new JLabel("Raza");
		lblRaza.setBounds(10, 68, 46, 14);
		frmNuevaMascota.getContentPane().add(lblRaza);
		
		JLabel lblCedulaDelDueo = new JLabel("Cedula del Due\u00F1o");
		lblCedulaDelDueo.setBounds(10, 99, 86, 14);
		frmNuevaMascota.getContentPane().add(lblCedulaDelDueo);
		
		JButton btnAgregar = new JButton("Agregar");
		btnAgregar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				cont.NuevaMascota();
			}
		});
		btnAgregar.setBounds(70, 146, 89, 23);
		frmNuevaMascota.getContentPane().add(btnAgregar);
	}

	@Override
	public void setVisible(boolean visible) {
		this.frmNuevaMascota.setVisible(true);
	}

	@Override
	public void cerrarVentana() {
		this.frmNuevaMascota.dispose();
	}
	
	public String getApodo(){
		return textField.getText();
	}
	
	public String getRaza(){
		return textField_1.getText();
	}
	
	public String getCedulaDuenio(){
		return textField_2.getText();
	}
}
